#ifndef SOCKET_H
#define SOCKET_H

#include <winsock2.h>
#include "SocketException.h"
#include "SocketInstance.h"
#include <string>
class Socket
{
public:
	Socket(SOCKET sockfd);
	Socket();
	Socket(const Socket& rhs);
	~Socket();

	int Receive(void *buf, unsigned int size);
	void Close();
	bool IsClosed() const;
	int Send(const void *buf, unsigned int size);
	SOCKET GetSocket() const;
	unsigned int ReceiveLeft() const;
	std::string PeerName() const;
	unsigned short PeerPort() const;
	static void Startup();
	static void Cleanup();

private:
	std::string ip;
	SocketInstance *instance;

	static bool winsockStarted;
};

#endif // SOCKET_H

